#!/bin/bash
set -e
ulimit -n 1000000

DEPLOY_DIR={{ deploy_dir }}
cd "${DEPLOY_DIR}" || exit 1

exec > >(tee -i -a "{{ alertmanager_log_dir }}/{{ alertmanager_log_filename }}")
exec 2>&1

exec bin/alertmanager \
    --config.file="{{ deploy_dir }}/conf/alertmanager.yml" \
    --storage.path="{{ alertmanager_data_dir }}" \
    --data.retention=120h \
    --log.level="{{ alertmanager_log_level }}" \
    --web.listen-address=":{{ alertmanager_port }}"
